package com.briup.recognition.web.controller;

import com.briup.recognition.bean.BaseRole;
import com.briup.recognition.service.IBaseRoleService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/baserole")
public class BaseRoleController {
    @Autowired
    private IBaseRoleService baseRoleService;

    @GetMapping("query")
    public Message query(){
        List<BaseRole> list = baseRoleService.query();
        return MessageUtil.success(list);
    }

    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(BaseRole baseRole){
        baseRoleService.saveOrUpdate(baseRole);
        return MessageUtil.success("操作成功");
    }

    @DeleteMapping("deleteById")
    public  Message deleteById(long id){
        baseRoleService.deleteById(id);
        return  MessageUtil.success("删除成功");
    }

}
